package ru.volgogradetzzz.utils {
	
	import ru.volgogradetzzz.math.VMatrix4x4;
	
	/**
	 * ...
	 * @author volgogradetzzz
	 */
	public function inverseRotationTranslationMatrix(m:VMatrix4x4, mCopyTo:VMatrix4x4):void {
		_ROTATION_PART.m11 = m.m11; _ROTATION_PART.m12 = m.m12; _ROTATION_PART.m13 = m.m13; _ROTATION_PART.m14 = 0;
		_ROTATION_PART.m21 = m.m21; _ROTATION_PART.m22 = m.m22; _ROTATION_PART.m23 = m.m23; _ROTATION_PART.m24 = 0;
		_ROTATION_PART.m31 = m.m31; _ROTATION_PART.m32 = m.m32; _ROTATION_PART.m33 = m.m33; _ROTATION_PART.m34 = 0;
		_ROTATION_PART.m41 = 0; 	_ROTATION_PART.m42 = 0; 	_ROTATION_PART.m43 = 0; 	_ROTATION_PART.m44 = 1;
		_ROTATION_PART.transpose();
		
		_TRANSLATION_PART.x = -m.m41;
		_TRANSLATION_PART.y = -m.m42;
		_TRANSLATION_PART.z = -m.m43;
		_TRANSLATION_PART.w = 1;
		
		_TRANSLATION_PART.multiplyByMatrix(_ROTATION_PART);
		
		mCopyTo.copyFrom(_ROTATION_PART);
		mCopyTo.m41 = _TRANSLATION_PART.x;
		mCopyTo.m42 = _TRANSLATION_PART.y;
		mCopyTo.m43 = _TRANSLATION_PART.z;
		//mCopyTo.setupTranslation(_TRANSLATION_PART.x, _TRANSLATION_PART.y, _TRANSLATION_PART.z);
	}
}

import ru.volgogradetzzz.math.VMatrix4x4;
import ru.volgogradetzzz.math.VVector3;
	
internal const _ROTATION_PART:VMatrix4x4 = new VMatrix4x4();
internal const _TRANSLATION_PART:VVector3 = new VVector3();